package com.oa.modules.approvalsec1.dao;

import com.oa.modules.approvalsec1.entity.UserBankEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 银行开户
 *
 * @author jiangwei
 * @email 785297226@qq.com
 * @date 2021-08-16 14:54:43
 */
@Mapper
public interface UserBankDao extends BaseMapper<UserBankEntity> {

    /**
     * 根据银行名称查询
     *
     * @author jiangwei
     * @email 785297226@qq.com
     * @date 2021-08-16 14:54:43
     * @Description 查询分页数据
     */
//    @Select("<script>select t1.*,t2.wx_open_id,t2.name from user_bank t1 left join sys_user t2 ON t1.userid = t2.user_id " +
//            "where 1=1 " +
//            "<if test='bankName != null'>and t1.bank_name in (${bankName}) </if> " +
//            "</script>")
    List<UserBankEntity> getByBankName(@Param("bankName") String bankName);

    /**
     * 根据银行名称查询
     *
     * @author jiangwei
     * @email 785297226@qq.com
     * @date 2021-08-16 14:54:43
     * @Description 查询分页数据
     */
    @Select("<script>select t1.*,t2.wx_open_id,t2.name from user_bank t1 left join sys_user t2 ON t1.userid = t2.user_id " +
            "where 1=1 " +
            "<if test='bankName != null'>and t1.bank_name like '%${bankName}%' </if> " +
            "</script>")
    List<UserBankEntity> getByLikeBankName(@Param("bankName") String bankName);
}
